#ifndef __HL2MasterServer_h__
#define __HL2MasterServer_h__
#include "MasterServer.h"
#include "ServerInfo.h"
#include "HL2ServerInfo.h"

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

using namespace std;

enum STEAM_REGION {
	STEAM_REGION_US_EC = 0x0,
	STEAM_REGION_US_WC = 0x1,
	STEAM_REGION_SA = 0x2,
	STEAM_REGION_EU = 0x3,
	STEAM_REGION_AS = 0x4,
	STEAM_REGION_AUS = 0x5,
	STEAM_REGION_ME = 0x6,
	STEAM_REGION_AF = 0x7,
	STEAM_REGION_OTHER = 0xff
};

class HL2MasterServer : public MasterServer {
	protected:
		struct sockaddr_in addr;
		stack<ServerInfo *> *servers;

		virtual ServerInfo *getServerInfo(const char *addr, int port);
	public:
		HL2MasterServer(const char *addr = "hl2master.steampowerd.com", int port = 27011);
		HL2MasterServer(HL2MasterServer &arg);
		virtual ~HL2MasterServer();
		virtual const struct sockaddr_in *getAddr() const;

		virtual stack<ServerInfo *> *list();
		virtual stack<ServerInfo *> *list(enum STEAM_REGION reg = STEAM_REGION_OTHER);

		virtual HL2MasterServer &operator=(const HL2MasterServer &arg);

		void clearList();
};

#endif
